package com.cn.lp.export.client.entity;


/**
 * 导入是用户类型
 * enum name控制在16字符内
 *
 * @author chenyongjue
 * @date 2019/10/31
 */
public enum ExportBusinessType {

    /**
     * TEST
     */
    TEST(BaseExportInfoParam.ExportDemoConditionVo.class, BaseExportInfoEvent.TestEvent::new, "测试"),

    ;

    /**
     * 入参condition类型
     */
    private final Class<?> conditionClassType;

    /**
     * 导出事件创建工厂
     */
    private final ExportHandleEventFactory<? extends ExportHandleEvent> factory;

    /**
     * 文件名
     */
    private String fileName;

    ExportBusinessType(Class<?> conditionClassType, ExportHandleEventFactory<? extends ExportHandleEvent> factory, String fileName) {
        assert conditionClassType != null && factory != null;
        this.conditionClassType = conditionClassType;
        this.factory = factory;
        this.fileName = fileName;
    }

    /**
     * 事件创建工厂
     *
     * @param <T>
     */
    public interface ExportHandleEventFactory<T extends ExportHandleEvent> {
        T create(BaseExportInfoParam.ExportEventVo exportEventVo);
    }

    public Class<?> getConditionClassType() {
        return conditionClassType;
    }

    public ExportHandleEventFactory<? extends ExportHandleEvent> getFactory() {
        return factory;
    }

    public String getFileName() {
        return fileName;
    }
}
